Skip to content

Validate trusted Admin hosts in auth flows - #1472

Merged
lizkenyon merged 4 commits into
mainfrom
liz/trusted-admin-host-validation
Oct 16, 2026
Merged

lizkenyon merged 4 commits into
mainfrom
liz/trusted-admin-host-validation

Conversation

@lizkenyon

@lizkenyon lizkenyon commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

This keeps authentication URL construction within Shopify's trusted Admin host boundaries.

  • Validate decoded embedded-app hosts before constructing the URL, while preserving permissive Base64 decoding and byte-for-byte output for supported legacy and unified Admin URLs.
  • Normalize and validate OAuth shop values before building the authorization route, including full URLs and current internal development hosts.
  • Raise the existing ShopifyAPI::Errors::InvalidShopError for untrusted input.

How has this been tested?

  • Added nine focused regression tests covering 19 representative scenarios; duplicate parser and ShopValidator cases were removed after targeted mutation review.
  • Confirmed the five security-focused regressions fail on clean current main before passing with this change.
  • Focused auth tests: 30 runs, 90 assertions, 0 failures.
  • Ruby 3.2.2, 3.3.7, and 3.4.3: library suite 351 runs / 709 assertions and REST wrapper suite 10,881 runs / 10,911 assertions, all passing on each version.
  • RuboCop: 108 files inspected, no offenses on each supported Ruby version.
  • Sorbet: no errors on each supported Ruby version.

Checklist:

  • My commit messages follow the linked convention.
  • I have performed a self-review of my own code.
  • I have added tests that prove the fix is effective.
  • I have updated the project documentation.
  • I have added changelog lines.

@github-actions github-actions Bot added the devtools-gardener Post the issue or PR to Slack for the gardener label Oct 14, 2026
@lizkenyon
lizkenyon marked this pull request as ready for review October 14, 2026 16:22

@Suleimanlatrsh Suleimanlatrsh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm requesting a small change for extra security.

Comment thread lib/shopify_api/auth/oauth.rb
@lizkenyon
lizkenyon merged commit 7afef6d into main Oct 16, 2026
7 checks passed
@lizkenyon
lizkenyon deleted the liz/trusted-admin-host-validation branch October 16, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devtools-gardener Post the issue or PR to Slack for the gardener

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants